package com.SunSoft.PhoneRemoteControl;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v4.view.az;
import android.support.v4.view.v;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import java.util.ArrayList;

public class MyViewPagerActivity extends Activity
  implements az, View.OnClickListener
{
  private ViewPager a;
  private ImageView[] b;
  private LinearLayout c;
  private int d = 4;
  private int e = 0;
  private int f = 0;
  private dh g;

  private static int a(Context paramContext, int paramInt)
  {
    return (int)(0.5F + paramContext.getResources().getDisplayMetrics().density * paramInt);
  }

  private void a()
  {
    LinearLayout.LayoutParams localLayoutParams;
    Button localButton;
    Resources localResources = getResources();
    Object localObject = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics((DisplayMetrics)localObject);
    int i = ((DisplayMetrics)localObject).widthPixels;
    BitmapFactory.Options localOptions = new BitmapFactory.Options();
    localOptions.inSampleSize = 1;
    if (i < 480)
      localOptions.inSampleSize = 2;
    ArrayList localArrayList = new ArrayList();
    if (this.f == 0)
    {
      localObject = new int[3];
      Object tmp80_79 = localObject;
      tmp80_79[0] = 2130837578;
      Object tmp85_80 = tmp80_79;
      tmp85_80[1] = 2130837579;
      Object tmp90_85 = tmp85_80;
      tmp90_85[2] = 2130837580;
      tmp90_85;
    }
    while (true)
    {
      i = 0;
      if (i < this.d)
        break;
      localObject = new db(this, localArrayList);
      this.a.a((v)localObject);
      return;
      localObject = new int[4];
      Object tmp131_130 = localObject;
      tmp131_130[0] = 2130837581;
      Object tmp136_131 = tmp131_130;
      tmp136_131[1] = 2130837582;
      Object tmp141_136 = tmp136_131;
      tmp141_136[2] = 2130837583;
      Object tmp146_141 = tmp141_136;
      tmp146_141[3] = 2130837584;
      tmp146_141;
    }
    LinearLayout localLinearLayout = new LinearLayout(this);
    localLinearLayout.setBackgroundDrawable(new BitmapDrawable(BitmapFactory.decodeResource(localResources, localObject[i], localOptions)));
    if (this.f == 0)
      if (i == 0)
      {
        localLayoutParams = new LinearLayout.LayoutParams(a(this, 100), a(this, 35));
        localLayoutParams.rightMargin = (a(this, 100) * -1);
        localLayoutParams.topMargin = a(this, 240);
        localLayoutParams.gravity = 53;
        localButton = new Button(this);
        localButton.setOnClickListener(new de(this));
        localButton.setBackgroundResource(2130837577);
        localButton.setLayoutParams(localLayoutParams);
        localLinearLayout.addView(localButton);
        localLayoutParams = new LinearLayout.LayoutParams(a(this, 100), a(this, 35));
        localLayoutParams.rightMargin = a(this, 5);
        localLayoutParams.topMargin = a(this, 410);
        localLayoutParams.gravity = 53;
        localButton = new Button(this);
        localButton.setOnClickListener(new df(this));
        localButton.setBackgroundResource(2130837577);
        localButton.setLayoutParams(localLayoutParams);
        localLinearLayout.addView(localButton);
        localLinearLayout.setGravity(5);
      }
    while (true)
    {
      while (true)
      {
        do
          while (true)
          {
            localArrayList.add(localLinearLayout);
            i += 1;
          }
        while (i != this.d - 1);
        localLayoutParams = new LinearLayout.LayoutParams(a(this, 100), a(this, 35));
        localLayoutParams.rightMargin = a(this, 5);
        localLayoutParams.bottomMargin = a(this, 2);
        localLayoutParams.gravity = 85;
        localButton = new Button(this);
        localButton.setOnClickListener(new dd(this));
        localButton.setBackgroundResource(2130837576);
        localButton.setLayoutParams(localLayoutParams);
        localLinearLayout.addView(localButton);
      }
      if (i == this.d - 1)
      {
        a(this, 12);
        localLayoutParams = new LinearLayout.LayoutParams(a(this, 100), a(this, 35));
        localLayoutParams.rightMargin = a(this, 5);
        localLayoutParams.bottomMargin = a(this, 2);
        localLayoutParams.gravity = 85;
        localButton = new Button(this);
        localButton.setText("");
        localButton.setOnClickListener(new dc(this));
        localButton.setBackgroundResource(2130837575);
        localButton.setLayoutParams(localLayoutParams);
        localLinearLayout.addView(localButton);
      }
      localLinearLayout.setGravity(5);
    }
  }

  private void a(View paramView)
  {
    int i;
    if (paramView.getBackground() != null)
      paramView.getBackground().setCallback(null);
    if (paramView instanceof ViewGroup)
      i = 0;
    while (true)
    {
      if (i >= ((ViewGroup)paramView).getChildCount())
      {
        ((ViewGroup)paramView).removeAllViews();
        return;
      }
      a(((ViewGroup)paramView).getChildAt(i));
      i += 1;
    }
  }

  public final void a(int paramInt)
  {
    int i = 0;
    if (i >= this.d)
    {
      this.b[paramInt].setImageDrawable(getResources().getDrawable(2130837618));
      if (this.e != paramInt + 1)
        break label135;
    }
    label135: for (TranslateAnimation localTranslateAnimation = new TranslateAnimation((paramInt + 1) * 30, paramInt * 30, 0.0F, 0.0F); ; localTranslateAnimation = null)
      while (true)
      {
        if (this.e == paramInt - 1)
          localTranslateAnimation = new TranslateAnimation((paramInt - 1) * 30, paramInt * 30, 0.0F, 0.0F);
        this.e = paramInt;
        localTranslateAnimation.setFillAfter(true);
        localTranslateAnimation.setDuration(300L);
        return;
        this.b[i].setImageDrawable(getResources().getDrawable(2130837617));
        i += 1;
      }
  }

  public final void a(int paramInt, float paramFloat)
  {
  }

  public final void b(int paramInt)
  {
  }

  public void onClick(View paramView)
  {
  }

  protected void onCreate(Bundle paramBundle)
  {
    int i;
    super.onCreate(paramBundle);
    setContentView(2130903083);
    this.c = ((LinearLayout)findViewById(2131165449));
    this.a = ((ViewPager)findViewById(2131165447));
    this.b = new ImageView[this.d];
    paramBundle = new LinearLayout.LayoutParams(-2, -2);
    paramBundle.gravity = 80;
    paramBundle.bottomMargin = 20;
    this.g = new dh(this);
    this.f = getIntent().getIntExtra("type_id", 0);
    this.g.a("isFirst", "NO");
    if (this.f == 0)
    {
      this.d = 3;
      i = 0;
    }
    while (true)
    {
      while (i >= this.d)
      {
        this.b[0].setImageDrawable(getResources().getDrawable(2130837618));
        this.a.a(this);
        a();
        return;
        this.d = 4;
      }
      if (i != 0)
        paramBundle.leftMargin = 10;
      this.b[i] = new ImageView(this);
      this.b[i].setLayoutParams(paramBundle);
      this.b[i].setScaleType(ImageView.ScaleType.MATRIX);
      this.b[i].setImageResource(2130837617);
      this.c.addView(this.b[i], i);
      i += 1;
    }
  }

  protected void onDestroy()
  {
    super.onDestroy();
    a(findViewById(2131165449));
    System.gc();
  }
}